<%@ page language="java" import="java.util.*,cs.sy.service.bean.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'foodDetail.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript">
		function del(id){
			location.href="delorder?id="+id;
		}
	</script>
  </head>
  
  <body>
  	<%List<AllDataBean> allDataBeans = (List<AllDataBean>)request.getAttribute("alldata"); 
  	UserBean user = (UserBean)request.getSession().getAttribute("user");
  	int total = 0;%>
  	<center><font size="5" color="red">welcome ${user.name }</font> 时间：${date }</center>
  	<%if(request.getAttribute("result") != null){ %>
  	<center><font color="red">${result }</font></center>	
  	<%} %>
    <table border="1" align="center">
    	<tr>
    		<th>序号</th>
    		<th>店名</th>
    		<th>姓名</th>
    		<th>菜名(价钱)</th>
    		<th>时间</th>
    		<th>付款状态</th>	
    		<th>操作</th>
    	</tr>
    	<%if(allDataBeans != null){ for(int i=0;i<allDataBeans.size();i++){if(allDataBeans.get(i).getS_status()==0) total = total + Integer.parseInt(allDataBeans.get(i).getFood_price());%>
    		<tr>
    			<td><%=i+1 %></td>
    			<td><%=allDataBeans.get(i).getShop_name() %></td>
    			<td><%=allDataBeans.get(i).getU_name() %></td>
    			<td><%=allDataBeans.get(i).getFood_name() %>[<font color="red"><%=allDataBeans.get(i).getFood_price() %>元</font>]</td>
    			<td><%=allDataBeans.get(i).getU_time() %></td>
    			<td><% if(allDataBeans.get(i).getS_status()==0){ %><font color="red">未付款</font><%}else{ %>付款成功<%} %></td>
    			<%if(user != null && user.getName().equals(allDataBeans.get(i).getU_name())){ %>	
    			<td><% if(allDataBeans.get(i).getS_status()==0){ %><a href="javascript:del(<%=allDataBeans.get(i).getId() %>);">删除</a>
    				<%}else{ %>已付款<%} %>
    			</td>
    			<%}else if(user.getName().equals("孙后继") && allDataBeans.get(i).getS_status()==0){%>
    				<td><a href="pay?id=<%=allDataBeans.get(i).getId() %>">付款</a></td>
    			<% }else{ %>
    			<td>别人的</td>
    			<%} %>
    		</tr>
    	<%} }%>
    	<tr>
    		<td>未付款总计：</td><td colspan="4"><font color="red" size="6"><strong><%=total %>元</strong></font></td>
    		<td><a href="/perfectfood">返回</a></td>
    	</tr>
    </table>
     <center><font color="red" size = "5">订餐电话 一招鲜(0731-85115859) 煨汤盖码饭(89824311/13787162397)</font></center>
  </body>
</html>
